package com.cuddleclones.imgdepot.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cuddleclones.imgdepot.model.Breed;
import com.cuddleclones.imgdepot.mapper.BreedMapper;
import com.cuddleclones.imgdepot.service.BreedService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.apache.commons.lang3.StringUtils;

import java.util.List;
/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zhoushuang
 * @since 2021-07-04
 */
@Service
@Transactional
public class BreedServiceImpl extends ServiceImpl<BreedMapper, Breed> implements BreedService {

    @Autowired
    private BreedMapper breedMapper;

    @Override
    public IPage<Breed> selectPage(Page<Breed> page, Breed breed) {
        QueryWrapper<Breed> queryWrapper = new QueryWrapper<Breed>();
        getQueryWrapper(queryWrapper,breed);
        return breedMapper.selectPage(page,queryWrapper);
    }

    @Override
    public List<Breed> selectList(Breed breed) {
        QueryWrapper<Breed> queryWrapper = new QueryWrapper<Breed>();
        getQueryWrapper(queryWrapper,breed);
        return breedMapper.selectList(queryWrapper);
    }

    /**
     *  公共查询条件
     * @param queryWrapper
     * @return
     */
    public QueryWrapper<Breed> getQueryWrapper(QueryWrapper<Breed> queryWrapper,Breed breed){
        //条件拼接
    
        return queryWrapper;
    }
}
